<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
    </head>
    <body>
        
    </body>
</html>
<script>
    // 定义一个变量
    // 变量命名规范
    var a = 20;

    // 运算符

    // 条件语句

    // 循环 for, while, do...while


    // number, string, obj, undefined, null[属于object], boolean
    // NaN 唯一一个和自己不相等的值


    // 函数

    // 字符串方法，数据方法，日期方法，随机数


    function func() {
        var a = 20;

        return function() {
            a++;
            console.log(a);
        };
    }

    var f = func();
    f();
    f();


    // DOM操作, 增删改查
    // BOM操作

    People.prototype.count = 0;
    function People(name, age, gender) {
        console.log(this);
        this.name = name;
        this.age = age;
        this.gender = gender;
        this.constructor.prototype.count++; 
    }

    // p1继承于 People.prototype
    var p1 = new People('小明', 20, '男');
    var p2 = new People('小刚', 23, '男');

    console.log(p1.count);
    console.log(p2.count);

    p1.constructor.prototype.count = 100;
    console.log(p2.count);


    // call, apply
    People.call({a: 20}, '小明', 33, '男');
    People.apply({b: 30}, ['小刚', 23, '男']);










</script>